package le;

import java.util.List;
import java.util.ArrayList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Pattern {

	public List<ValenceUnit> valenceUnits = new ArrayList<ValenceUnit>();
	public List<String> annoIds = new ArrayList<String>();
	
	public Pattern(Element e) {
		NodeList ns = e.getChildNodes();
		for (int i=0;i<ns.getLength();i++) {
			Node n = ns.item(i);
			String s = n.getNodeName();
			if (s.equals("valence-unit")) {
				valenceUnits.add(new ValenceUnit((Element) n));	
			}
			else if (s.equals("annotationSet-ids")) {
				NodeList ps = ((Element) n).getChildNodes();
				for (int j=0;j<ps.getLength();j++) {
					Node p = ps.item(j);
					if (p.getNodeName().equals("id")) {
					    annoIds.add(((Element) p).getTextContent());														
					}
				}							
			}
		}
	}
	
}
